public class Anagram {
    public static void main(String[] args) {
        final int WORD_1 = 0;
        final int WORD_2 = 1;

        if(args.length < 2){
            System.out.println(Messages.ANAGRAM_INPUT_REQUEST);
            return;
        }

        String word1 = args[WORD_1].toLowerCase().replaceAll(" ", "");
        String word2 = args[WORD_2].toLowerCase().replaceAll(" ", "");

        if (word1.length() != word2.length()) {
            System.out.println(Messages.WORDS_HAS_DIFFERENT_SIZE);
            System.exit(0);
        }

        int charactersSum1 = 0;
        int charactersSum2 = 0;

        for (int i = 0, j = word1.length(); i < j; i++) {
            charactersSum1 += word1.charAt(i);
            charactersSum2 += word2.charAt(i);
        }

        if (charactersSum1 == charactersSum2) {
            System.out.println(Messages.NOT_ANAGRAMS);
        } else {
            System.out.println(Messages.IS_ANAGRAMS);
        }

    }
}
